<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>工作日志-首页</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link rel="stylesheet" href="/newmain/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="/newmain/css/bootstrap-responsive.min.css"/>
    <link rel="stylesheet" href="/newmain/css/fullcalendar.css"/>
    <link rel="stylesheet" href="/newmain/css/matrix-style.css"/>
    <link rel="stylesheet" href="/newmain/css/matrix-media.css"/>
    <link href="/newmain/font-awesome/css/font-awesome.css" rel="stylesheet"/>
    <link rel="stylesheet" href="/newmain/css/jquery.gritter.css"/>
</head>
<body>


<!--main-container-part-->
<div id="content">
    <!--Action boxes-->
    <div class="container-fluid">
        <div class="quick-actions_homepage">
            <ul class="quick-actions">
                <li class="bg_lb">
                    <a href="/index/mainclerk2?key='jssl'" target="myframe" id="ajtitle">
                        <i class="icon-download-alt"></i>
                        案件接收
                    </a>
                </li>
                <li class="bg_ls">
                    <a href="/index/mainclerk2?key='zzjcsl'" target="myframe">
                        <i class="icon-folder-open-alt"></i>
                        检查案件
                    </a>
                </li>
                <li class="bg_ly">
                    <a href="/index/mainclerk2?key='yjslsl'" target="myframe">
                        <i class="icon-book"></i>
                        <span class="label label-important"></span>
                        案件审理
                    </a>
                </li>
                <li class="bg_lo">
                    <a href="/index/mainclerk2?key='yjzxsl'" target="myframe">
                        <i class="icon-forward"></i>
                        案件执行
                    </a>
                </li>
                <li class="bg_lg">
                    <a href="/index/mainclerk2?key='jasl'" target="myframe">
                        <i class="icon-ok-circle"></i>
                        结案
                    </a>
                </li>
                <li class="bg_lg">
                    <a href="http://100.12.64.172:8888/zcfgknw/index.html" target="_blank" rel="noopener noreferrer">
                        <i class="icon-th-list"></i>
                        政策法规
                    </a>
                </li>
                <!--				 <li class="bg_lr">-->
                <!--                    <a href="/index/error405" target="myframe">-->
                <!--                        <i class="icon-th-list"></i>-->
                <!--                        工作绩效-->
                <!--                    </a>-->
                <!--                </li>-->
                <!--                <li class="bg_lv">-->
                <!--                    <a href="/index/error405" target="myframe">-->
                <!--                        <i class="icon-star-empty"></i>-->
                <!--                        积案清理-->
                <!--                    </a>-->
                <!--                </li>-->
            </ul>
        </div>
        <!-- 嵌入页面 -->
        <iframe id="myframe" name="myframe" title="myframe" th:src="@{/index/mainclerk2?key='jssl'}"
                onload="this.style.height=this.contentWindow.document.body.scrollHeight+'px';"
                style="min-height:628px;border-width:0;marginheight:0px;seamless:true;width: 100%"
                height="100%"></iframe>
        <hr/>
    </div>
</div>

<!--end-main-container-part-->
<div id="layerDemo" style="margin-bottom: 0; display: none">
    <div data-method="offset" data-type="rb" id="xxtxInput"
         class="layui-btn layui-btn-normal">
    </div>
</div>

<script src="/layui/layui.all.js" charset="utf-8"></script>
<script src="/js/jquery.min.js"></script>
<script src="/js/core.util.js"></script>
<script>

    layui.use('layer', function () {
        var $ = layui.jquery, layer = layui.layer;

        //触发事件
        var active = {
            offset: function (othis) {
                var type = othis.data('type'), text = othis.text();
                let arr = text.split("-");

                layer.open({
                    type: 1,
                    offset: type,
                    id: 'layerDemo' + type, //防止重复弹出
                    content: '<div style="padding: 10px 50px;">'
                        + '<div style="cursor:pointer" onclick="skipOpen(&quot;/index/workrisk/riskPage11&quot;,&quot;11001&quot;,&quot;个人提醒&quot;)")" >提醒事件：' + arr[1]
                        + '条，请处理!</div>'
                        + '<br/>'
                        + '<div style="cursor:pointer" onclick="skipOpen(&quot;/index/workrisk/controlPage11&quot;,&quot;11101&quot;,&quot;个人督办&quot;)">督办事件：' + arr[0]
                        + '条，请处理</div>'
                        + '<br/>'
                        + '<div style="cursor:pointer" onclick="skipOpen(&quot;/index/attention/attentionCase&quot;,&quot;80101&quot;,&quot;关注案件&quot;)">关注事件：0'
                        + '条，请处理!</div>'
                        + '</div>',

                    btn: '关闭',
                    btnAlign: 'c',//按钮居中
                    shade: 0,//不显示遮罩
                    yes: function () {
                        layer.closeAll();
                    }
                });
            }
        };

        $('#layerDemo .layui-btn').on('click', function () {
            var othis = $(this), method = othis.data('method');
            active[method] ? active[method].call(this, othis) : '';
        });
    });
    $(function () {

        CoreUtil.sendPost("/sys/getXxtx", null, function (res) {
            if (res.code == "0") {
                var list = res.data;
                var list0 = list[0]; // 提醒
                var list1 = list[1]; // 督办

                $("#xxtxInput").html(list0 + "-" + list1);

                $('#layerDemo .layui-btn').trigger("click");
            }
        });
    })

    function skipOpen(gnurl, gnid, title) {
        if (CoreUtil.isEmpty(gnurl) || CoreUtil.isEmpty(gnid) || CoreUtil.isEmpty(title)) {
            return false;
        } else {
            var gnurlArr = gnurl.split(",");
            var gnidArr = gnid.split(",");
            var titleArr = title.split(",");
            for (var i in gnurlArr) {
                tianzhuan(gnurlArr[i], gnidArr[i], titleArr[i])
            }
        }
    }

    function tianzhuan(gnurl, gnid, title) {
        if ($(".layui-tab-title li[lay-id]").length <= 0) {
            var title = "<span>" + title + "</span>";
            active.tabAdd(gnurl, gnid, title);
        } else {
            var isData = false;
            $.each($(".layui-tab-title li[lay-id]"),
                function () {
                    if ($(this).attr("lay-id") == dataid.attr("data-id")) {
                        isData = true;
                    }
                })
            if (isData == false) {
                if (CoreUtil.isEmpty(dataid
                    .attr("data-icon"))) {
                    var title = "<span>"
                        + dataid.attr("data-title")
                        + "</span>";
                    active.tabAdd(dataid.attr("data-url"),
                        dataid.attr("data-id"), title);
                } else {
                    var title = "<span>"
                        + dataid.attr("data-title")
                        + "</span>";
                    title = '<i class="layui-icon '
                        + dataid.attr("data-icon")
                        + '"></i> ' + title;
                    active.tabAdd(dataid.attr("data-url"),
                        dataid.attr("data-id"), title);
                }
            }
        }
        active.tabChange(gnid);
    }

    //触发事件
    var active = {
        tabAdd: function (url, id, title) {
            if (url != "" && url != null && url != undefined) {
                window.parent.layui.element
                    .tabAdd(
                        'tab',
                        {
                            title: title,
                            content: '<iframe data-frameid="'
                                + id
                                + '" frameborder="0" name="content" width="100%" src="'
                                + url + '"></iframe>',
                            id: id
                        })
            }
            FrameWH();//计算框架高度
        },
        tabChange: function (id) {
            //切换到指定Tab项
            window.parent.layui.element.tabChange('tab', id); //切换到：用户管理
            $("iframe[data-frameid='" + id + "']").attr("src",
                $("iframe[data-frameid='" + id + "']").attr("src"))//切换后刷新框架
        },
    };

    function FrameWH() {
        var h = $(window).height();
        $(window.parent.document).find("iframe").css("height", h + "px");
    }
</script>
</body>
</html>
